package com.yyk.yykywd

import com.orhanobut.hawk.Hawk
import com.yyk.yykywd.util.ToastUtil

/**
 * 文件描述：
 * Created by guo on 2019-11-27.
 */

fun putUid(id: String) {
    Hawk.put(ID, id)
}

fun getUid(): String {
    return Hawk.get(ID)
}

fun putName(name: String) {
    Hawk.put(NAME, name)
}

fun getName(): String {
    return Hawk.get(NAME)
}

fun putPhone(phone: String) {
    Hawk.put(PHONE, phone)
}

fun getPhone(): String {
    return Hawk.get(PHONE)
}

fun putLevel(level: String) {
    Hawk.put(LEVEL, level)
}

fun getLevel(): String {
    return Hawk.get(LEVEL)
}

fun putDepartment(department: String) {
    Hawk.put(DEPARTMENT, department)
}

fun getDepartment(): String {
    return Hawk.get(DEPARTMENT)
}

//是否可以点击工作界面的回款完成，安装医院，新增客户，意向客户，C类客户，签订合同按钮
fun putPersonalPermission(permission: Int) {
    Hawk.put(TYPE, permission)
}

fun getPersonalPermission(): Int {
    return Hawk.get(TYPE)
}

fun whetherHavePermission(): Boolean {
    if (getPersonalPermission() != 1) {
        ToastUtil.showShort("暂无权限")
        return true
    }
    return false
}

//是否可以创建会议
fun putWhetherCanCreateMeeting(whetherCanCreteMeeting: Int) {
    Hawk.put(FLAG, whetherCanCreteMeeting)
}

fun getWhetherCanCreateMeeting(): Int {
    return Hawk.get(FLAG)
}

fun whetherHaveMeetingPermission(): Boolean {
    if (getWhetherCanCreateMeeting() != 1) {
        ToastUtil.showShort("暂无权限")
        return true
    }
    return false
}

//是否属于普通员工
fun putWhetherIsStaff(isStaff: Int) {
    Hawk.put(IS_STAFF, isStaff)
}

fun getWhetherIsStaff(): Int {
    return Hawk.get(IS_STAFF)
}

fun deleteUserData() {
    Hawk.delete(ID)
    Hawk.delete(NAME)
    Hawk.delete(PHONE)
    Hawk.delete(LEVEL)
    Hawk.delete(DEPARTMENT)
    Hawk.delete(TYPE)
    Hawk.delete(FLAG)
    Hawk.delete(IS_STAFF)
}
